public class Thread_Test {
    static volatile int count = 0;
    public static void main1(String[] args) throws InterruptedException {
        for (int i = 0; i < 20; i++) {
            Thread thread = new Thread(() -> {
                System.out.print(count++ + " ");
            });
            thread.start();
            thread.join();
        }
        Thread t = new Thread(() -> {
            System.out.println("ok");
        });
        t.start();
    }
    public static void main(String[] args) {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("1");
            }
        });
        t.start();
        System.out.println("2");
    }
}
